package com.itheima.service.impl;

import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public boolean add(User user) {
        int result = userMapper.add(user);

        return result>0;
    }

    @Override
    public boolean deleteById(String id) {
        int result = userMapper.deleteById(id);
        return result>0;
    }

    @Override
    public boolean update(User user) {
        int result = userMapper.update(user);
        return result>0;
    }

    @Override
    public List<User> select() {
        List<User> users = userMapper.selectAll();
        return users;
    }
}
